package com.ynu.yx.chatroleai.model;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.time.LocalDateTime;

@Data
@TableName("chat_messages") // 对话消息表，用于存储对话消息；使用者->AI角色，AI角色->使用者。
public class ChatMessage {
    @TableId(type = IdType.AUTO)
    private Long id;

    @TableField(value = "message_id")
    private Long messageId;  //  消息ID

    @TableField(value = "conversation_id")
    private Long conversationId;  //  会话ID

    @TableField(value = "sender")
    private String sender; //  发送者

    @TableField(value = "content")
    private String content; // 内容

    @TableField(value = "timestamp",  fill = FieldFill.INSERT)
    private LocalDateTime timestamp; // 对话创建的时间

    @TableField(value = "token_count")
    private Integer tokenCount; // 统计消耗的token数量

    @TableField(value = "processing_time")
    private Double processingTime; // 回复耗时

    @TableField(value = "audio_url")
    private String audioUrl; // 语音消息的音频文件地址

    @TableField(value = "is_voice_message")
    private Boolean isVoiceMessage; // 是否为语音消息

    @TableField(value = "voice_duration")
    private String voiceDuration; // 语音持续时长

    @TableLogic
    @TableField(value = "is_deleted")
    private Integer isDeleted;

    // 非数据库字段
    @TableField(exist = false)
    private Conversation conversation;
}
